import * as ajax from "../../common/ajax";

export const get = id => ajax.get("/admin/holiday/" + id);

export const create = () => ajax.post("/admin/holiday/writeData");

export const deleteItem = id => ajax.pureDelete("/admin/major/" + id);

export const update = entity => ajax.put("/admin/holiday", entity);

// 在前端的 API 调用中，根据是否传递日期参数来调用不同的路径
export const getPage = date => {
  if (date != null) {
    return ajax.get("/admin/holiday/getData/" + date);
  } else {
    return ajax.get("/admin/holiday/getData");
  }
};

export const listName = () => ajax.pureGet("/admin/major/names");
